package API.DAY3.collection;

import java.util.Collection;
import java.util.HashSet;
//add()添加,clear()清除
public class CollectionDemo1 {
    public static void main(String[] args) {
//        Collection a = new ArrayList<>();
        Collection a = new HashSet();
        a.add("1");
        a.add("2");
        a.add("3");
        a.add("4");
        a.add("5");
        boolean b = a.add("1");
        System.out.println(b);

        System.out.println(a);
        System.out.println("Size? "+a.size());
        System.out.println("空集? "+a.isEmpty());
        a.clear();
        System.out.println("Size? "+a.size());
        System.out.println("空集? "+a.isEmpty());
    }
}
